#include "hardwareUART.h"

void HardwareUART::set_buf_ptr()
{
    switch (uart_x)
    {
#ifdef HAVE_SERIAL1
    case UART_1:
        buf = &UART1_recbuf;
        return;
#endif
#ifdef HAVE_SERIAL2
    case UART_2:
        buf = &UART2_recbuf;
        return;
#endif
#ifdef HAVE_SERIAL3
    case UART_3:
        buf = &UART3_recbuf;
        return;
#endif
#ifdef HAVE_SERIAL4
    case UART_4:
        buf = &UART4_recbuf;
        return;
#endif
#ifdef HAVE_SERIAL5
    case UART_5:
        buf = &UART5_recbuf;
        return;
#endif
    default:
        buf = 0;
        return;
    }
}

size_t HardwareUART::write(uint8_t data)
{
    uart_write_byte(uart_x, data);
    return 0;
}

size_t HardwareUART::write(const uint8_t *buffer, size_t size)
{
    uart_write_buffer(uart_x, buffer, size);
    return 0;
}

